/*
 * @Author: Creator
 * @Date: 2020-09-27 21:42:22
 * @LastEditors: Creator
 * @LastEditTime: 2020-10-09 21:39:59
 * @Description: file content
 */

#ifndef PATIENT_H
#define PATIENT_H

#include <stdio.h>
#include <stdbool.h>
typedef struct Patient
{
    char name[20];                                          // attention ： 不用 *
    int age;
    char idetify_card[18];
}Patient;

void assginmentPatient(Patient* a, Patient* b);
int judgeInputPatient(Patient* inputData);
int judgeYear(Patient* a);
int judgeIdentifyCard(Patient* a);
void displayPatient(Patient* a);

typedef struct Patient_node
{
    Patient data;
    struct Patient_node* pre;
    struct Patient_node* next;

} PatientNode;                                                             // 链表 节点 Node         



bool isPatientNodeListEmpty(PatientNode* List);
void changePatientNode(PatientNode* a,Patient* Data);
PatientNode* createPatientNode( Patient* Data);
int addPatientNode(PatientNode* List,Patient* Data);
int deletePatientNode(PatientNode* List);
PatientNode* findPatientNode(PatientNode* List,char idetifyCard[19]);
int cleanPatientNode(PatientNode* List);
void displayPatientNode(PatientNode* List);

// 处理文件

Nature PatientNum;                                             // 记录患者的数量
PatientNode* readAPatient(FILE* fp);                                         // 加载单个患者信息
PatientNode* loadPatientList();                                            // 加载患者信息
PatientNode* createNullPatientNode();                                       // 创建空节点用于存储信息
bool writeAPatient(FILE* fp, PatientNode* patient);                         // 写入一个患者
bool writePatientList(PatientNode* PatientList);                            // 写入患者链表


#endif //PATIENT_H